\hypertarget{class_caziac_1_1_http_1_1_handle_response}{
\section{Caziac::Http::HandleResponse Class Reference}
\label{class_caziac_1_1_http_1_1_handle_response}\index{Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}}
}


Handle for an HtttpResponse.  




{\ttfamily \#include $<$HandleResponse.hh$>$}

\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_caziac_1_1_http_1_1_handle_response_a1338ff4538b140316e33b8b28875b53b}{
typedef std::map$<$ std::string, std::string $>$ {\bfseries Header}}
\label{class_caziac_1_1_http_1_1_handle_response_a1338ff4538b140316e33b8b28875b53b}

\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_caziac_1_1_http_1_1_handle_response_a92c478219fb9805e312dbd8275c37282}{HandleResponse} (\hyperlink{class_caziac_1_1_tools_1_1_i_writer}{Tools::IWriter} $\ast$writer)
\begin{DoxyCompactList}\small\item\em constructor of the \hyperlink{class_caziac_1_1_http_1_1_handle_response}{HandleResponse} \item\end{DoxyCompactList}\item 
\hypertarget{class_caziac_1_1_http_1_1_handle_response_a8cbec7f722ed2eebab00ce0fdc864271}{
virtual \hyperlink{class_caziac_1_1_http_1_1_handle_response_a8cbec7f722ed2eebab00ce0fdc864271}{$\sim$HandleResponse} ()}
\label{class_caziac_1_1_http_1_1_handle_response_a8cbec7f722ed2eebab00ce0fdc864271}

\begin{DoxyCompactList}\small\item\em destructor of the \hyperlink{class_caziac_1_1_http_1_1_handle_response}{HandleResponse} \item\end{DoxyCompactList}\item 
Header const \& \hyperlink{class_caziac_1_1_http_1_1_handle_response_aa32232408739a226a95c5c15a294e90c}{getHeader} () const 
\begin{DoxyCompactList}\small\item\em this function get the header of the Response \item\end{DoxyCompactList}\item 
\hyperlink{struct_caziac_1_1_http_1_1_line_response}{LineResponse} \& \hyperlink{class_caziac_1_1_http_1_1_handle_response_ab9d216c966e4f560a888997696c7432b}{getLineResponse} ()
\begin{DoxyCompactList}\small\item\em this function get the \hyperlink{struct_caziac_1_1_http_1_1_line_response}{LineResponse} (method url version) \item\end{DoxyCompactList}\item 
\hyperlink{class_caziac_1_1_tools_1_1_i_writer}{Tools::IWriter} $\ast$ \hyperlink{class_caziac_1_1_http_1_1_handle_response_a7e46c1b2e7a492ae67701f12e3a91b5e}{getWriter} ()
\item 
void \hyperlink{class_caziac_1_1_http_1_1_handle_response_acd7c259957c8c09a0d5a33b8b1ff1192}{pack} ()
\begin{DoxyCompactList}\small\item\em write The \hyperlink{struct_caziac_1_1_http_1_1_line_request}{LineRequest}, the Header content and an empty line \item\end{DoxyCompactList}\item 
bool \hyperlink{class_caziac_1_1_http_1_1_handle_response_a7600e35fb60fcaeff87af20f5057524b}{sendBody} (std::string const \&bodyPart)
\begin{DoxyCompactList}\small\item\em send a body line or an entire body \item\end{DoxyCompactList}\item 
\hypertarget{class_caziac_1_1_http_1_1_handle_response_a39c33416082a3db063ab57bd60cd4fbf}{
void \hyperlink{class_caziac_1_1_http_1_1_handle_response_a39c33416082a3db063ab57bd60cd4fbf}{addDescription} (std::string const \&key, std::string const \&def)}
\label{class_caziac_1_1_http_1_1_handle_response_a39c33416082a3db063ab57bd60cd4fbf}

\begin{DoxyCompactList}\small\item\em add a description to the Header \item\end{DoxyCompactList}\item 
virtual bool \hyperlink{class_caziac_1_1_http_1_1_handle_response_a2b0c01ec6e243d19545ab88cc4f2a86e}{operator==} (bool const)
\begin{DoxyCompactList}\small\item\em \mbox{[}User Implementation\mbox{]} \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Handle for an HtttpResponse. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_caziac_1_1_http_1_1_handle_response_a92c478219fb9805e312dbd8275c37282}{
\index{Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}!HandleResponse@{HandleResponse}}
\index{HandleResponse@{HandleResponse}!Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}}
\subsubsection[{HandleResponse}]{\setlength{\rightskip}{0pt plus 5cm}Caziac::Http::HandleResponse::HandleResponse (
\begin{DoxyParamCaption}
\item[{{\bf Tools::IWriter} $\ast$}]{ writer}
\end{DoxyParamCaption}
)}}
\label{class_caziac_1_1_http_1_1_handle_response_a92c478219fb9805e312dbd8275c37282}


constructor of the \hyperlink{class_caziac_1_1_http_1_1_handle_response}{HandleResponse} 


\begin{DoxyParams}{Parameters}
\item[{\em writer}]the Socket writer This will set attribue \char`\"{}\_\-writer\char`\"{} for later using \end{DoxyParams}


\subsection{Member Function Documentation}
\hypertarget{class_caziac_1_1_http_1_1_handle_response_aa32232408739a226a95c5c15a294e90c}{
\index{Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}!getHeader@{getHeader}}
\index{getHeader@{getHeader}!Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}}
\subsubsection[{getHeader}]{\setlength{\rightskip}{0pt plus 5cm}Header const\& Caziac::Http::HandleResponse::getHeader (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{class_caziac_1_1_http_1_1_handle_response_aa32232408739a226a95c5c15a294e90c}


this function get the header of the Response 

\begin{DoxyReturn}{Returns}
the header
\end{DoxyReturn}
This function return the header parsed by the user with the consumeHeaderLine method. This member function is for consulting. \hypertarget{class_caziac_1_1_http_1_1_handle_response_ab9d216c966e4f560a888997696c7432b}{
\index{Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}!getLineResponse@{getLineResponse}}
\index{getLineResponse@{getLineResponse}!Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}}
\subsubsection[{getLineResponse}]{\setlength{\rightskip}{0pt plus 5cm}{\bf LineResponse}\& Caziac::Http::HandleResponse::getLineResponse (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_caziac_1_1_http_1_1_handle_response_ab9d216c966e4f560a888997696c7432b}


this function get the \hyperlink{struct_caziac_1_1_http_1_1_line_response}{LineResponse} (method url version) 

\begin{DoxyReturn}{Returns}
the line response 
\end{DoxyReturn}
\begin{DoxyWarning}{Warning}
call readResponseHeader before to set the \hyperlink{struct_caziac_1_1_http_1_1_line_response}{LineResponse} attributes 
\end{DoxyWarning}
\hypertarget{class_caziac_1_1_http_1_1_handle_response_a7e46c1b2e7a492ae67701f12e3a91b5e}{
\index{Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}!getWriter@{getWriter}}
\index{getWriter@{getWriter}!Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}}
\subsubsection[{getWriter}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Tools::IWriter}$\ast$ Caziac::Http::HandleResponse::getWriter (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_caziac_1_1_http_1_1_handle_response_a7e46c1b2e7a492ae67701f12e3a91b5e}
\begin{DoxyReturn}{Returns}
the writer 
\end{DoxyReturn}
\hypertarget{class_caziac_1_1_http_1_1_handle_response_a2b0c01ec6e243d19545ab88cc4f2a86e}{
\index{Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}!operator==@{operator==}}
\index{operator==@{operator==}!Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}}
\subsubsection[{operator==}]{\setlength{\rightskip}{0pt plus 5cm}Caziac::Http::HandleResponse::operator== (
\begin{DoxyParamCaption}
\item[{bool const}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{class_caziac_1_1_http_1_1_handle_response_a2b0c01ec6e243d19545ab88cc4f2a86e}


\mbox{[}User Implementation\mbox{]} 

This function should return true if the \hyperlink{struct_caziac_1_1_http_1_1_line_response}{LineResponse} status is OK but a USER can redefine this function for some specifications. \hypertarget{class_caziac_1_1_http_1_1_handle_response_acd7c259957c8c09a0d5a33b8b1ff1192}{
\index{Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}!pack@{pack}}
\index{pack@{pack}!Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}}
\subsubsection[{pack}]{\setlength{\rightskip}{0pt plus 5cm}void Caziac::Http::HandleResponse::pack (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_caziac_1_1_http_1_1_handle_response_acd7c259957c8c09a0d5a33b8b1ff1192}


write The \hyperlink{struct_caziac_1_1_http_1_1_line_request}{LineRequest}, the Header content and an empty line 

\begin{DoxyWarning}{Warning}
this function must be call at the end of Header parsing
\end{DoxyWarning}
for example this code :


\begin{DoxyCode}
        
        LineResponse    line;
        
        line.version = "HTTP/1.1";
        line.status = Caziac::Http::OK;
        Caziac::Http::HttpStatus[LineResponse.status] = "OK";
        addDescription("Content-Length", "20")
\end{DoxyCode}


will send this to the reader :


\begin{DoxyItemize}
\item \char`\"{}HTTP/1.1 200 OK\char`\"{}
\item \char`\"{}Content-\/Length : 20\char`\"{}
\item \char`\"{}\char`\"{}
\end{DoxyItemize}

The content is not send to the writer with this function. \hypertarget{class_caziac_1_1_http_1_1_handle_response_a7600e35fb60fcaeff87af20f5057524b}{
\index{Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}!sendBody@{sendBody}}
\index{sendBody@{sendBody}!Caziac::Http::HandleResponse@{Caziac::Http::HandleResponse}}
\subsubsection[{sendBody}]{\setlength{\rightskip}{0pt plus 5cm}Caziac::Http::HandleResponse::sendBody (
\begin{DoxyParamCaption}
\item[{std::string const \&}]{ bodyline}
\end{DoxyParamCaption}
)}}
\label{class_caziac_1_1_http_1_1_handle_response_a7600e35fb60fcaeff87af20f5057524b}


send a body line or an entire body 

\begin{DoxyWarning}{Warning}
if the Header wasn't send it will send automatically the header before 
\end{DoxyWarning}
\begin{DoxyReturn}{Returns}
true if the entire line was send
\end{DoxyReturn}
This function check the \char`\"{}Content-\/length\char`\"{} value of the Header, this will return false if the the length is too big. For example if you have:

In the header \char`\"{}Content-\/length : 20\char`\"{} 
\begin{DoxyCode}
        sendLine("Star wars \r\n");     // First call return true (size = 12)
        sendLine("Star wars \r\n");     // Second call return false (size = 12)
\end{DoxyCode}


This will send only the first call 

The documentation for this class was generated from the following file:\begin{DoxyCompactItemize}
\item 
\hyperlink{_handle_response_8hh}{HandleResponse.hh}\end{DoxyCompactItemize}
